<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

		<link rel="stylesheet" type="text/css"
			href="/css/bootstrap.css">
		<link rel="stylesheet" type="text/css"
			href="/css/theme.css"> 
<script src="/jquery/jquery.min.js" 
			type="text/javascript"></script>
<script src="/bootstrap/js/bootstrap.min.js"></script>
<script src="/layer-v2.4/layer/layer.js"
			type="text/javascript"></script>
<script src="/jquery/my.js" type="text/javascript"></script>
<style type="text/css">
.table>tbody>tr.success>td {
	padding-top: 50px;
}

.table>tbody>tr.success>td.td {
	padding-top: 18px;
}

.table>tbody>tr.success>td.pi {
	padding-top: 2px;
}

.table>tbody>tr.info>td {
	padding-top: 50px;
}

.table>tbody>tr.info>td.td {
	padding-top: 18px;
}

.table>tbody>tr.info>td.pi {
	padding-top: 2px;
}
</style>
</head>
<body>
	<div class="container">
		<div class="header">
			<h1 class="page-title">
				电影管理
			</h1>
		</div>
		<ul class="breadcrumb">
			<li>
				<a href="index.jsp">Home</a>
				<span class="divider">/</span>
			</li>
			<li class="active">
				电影列表
			</li>
		</ul>
		<div class="row clearfix">
			<div class="col-md-12 column">
				<div class="col-md-9 column" style="display: inline-block;">
					<form:form action="/film/list" method="get" modelAttribute="film">
						<strong style="color: red">商品名称:</strong>
						<input name="filmname"/>
						<input type="submit" value="查询" class="btn btn-info">
					</form:form>
				</div>
				<div class="col-md-3 column" style="display: inline-block;margin-left: 500px;">
					<form action="/film/add">
						<input type="submit" value="发布电影" class="btn btn-primary">
					</form>
				</div>
			</div>
		</div>
		<div class="row clearfix">
			<div class="col-md-12 column">
				<table class="table table-bordered">
					<thead>
						<tr>
							<th>电影名</th>
							<th>导演</th>
							<th>主演</th>
							<th>编剧</th>
							<th>剧照</th>
							<th>上映时间</th>
							<th>影片价格</th>
							<th>语言</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody class="tbody">
						<c:forEach items="${pager.list}" var="film">
							<c:if test="${film.filmId % 2 == 0}">
								<tr class="info" align="center">
									<td>${film.filmName}</td>
									<td>${film.filmDirector}</td>
									<td>${film.filmAcotr}</td>
									<td>${film.filmWriter}</td>
									<td class="pi"><img src="/assets/img/${film.filmCover}"
										style="display: inline-block; height: 100px; width: 100px;" />
									</td>
									<td><fmt:formatDate value="${film.filmShowdate}"
											pattern="yyyy-MM-dd" /></td>
									<td>${film.filmPrice}</td>
									<td>${film.filmLanguage}</td>
									<td class="td">
										<form action="/film/delete/${film.filmId}" method="post" class="im_tijiao">
											<input type="hidden" name="_method" value="DELETE"> <input
												type="submit" value="删除" class="dianji btn btn-danger">
										</form>
										<form action="/film/detail/${film.filmId}" method="get">
											<input type="submit" value="修改" class="btn btn-info">
										</form>
									</td>
								</tr>
							</c:if>
							<c:if test="${film.filmId % 2 == 1}">
								<tr class="success" align="center">
									<td>${film.filmName}</td>
									<td>${film.filmDirector}</td>
									<td>${film.filmAcotr}</td>
									<td>${film.filmWriter}</td>
									<td class="pi"><img src="/assets/img/${film.filmCover}"
										style="display: inline-block; height: 100px; width: 100px;" />
									</td>
									<td><fmt:formatDate value="${film.filmShowdate}"
											pattern="yyyy-MM-dd" /></td>
									<td>${film.filmPrice}</td>
									<td>${film.filmLanguage}</td>
									<td class="td">
										<form action="/film/delete/${film.filmId}" method="post" class="im_tijiao">
											<input type="hidden" name="_method" value="DELETE"> <input
												type="button" value="删除" class="dianji btn btn-danger">
										</form>
										<form action="/film/detail/${film.filmId}" method="get">
											<input type="submit" value="修改" class="btn btn-info">
										</form>
									</td>
								</tr>
							</c:if>
						</c:forEach>
					</tbody>
				</table>
				<div class="pagination pagination-right">
					<ul>
						<li><a>共计：${pager.pagectrl.pagecount}页/${pager.pagectrl.rscount}条记录</a>
						</li>

						<li><c:if test="${pager.pagectrl.currentindex==1}" var="fp">
								<a style="disabled: true">上一页</a>
							</c:if> <c:if test="${!fp}">
								<a
									href="/film/list?filmname=${param.filmname}&current=${pager.pagectrl.currentindex-1}">上一页</a>
							</c:if></li>

						<c:forEach begin="${pager.pagectrl.minpage}" step="1"
							end="${pager.pagectrl.maxpage}" var="index">
							<li><c:if test="${pager.pagectrl.currentindex==index}"
									var="t">
									<a style="color: red; background-color: #bbb">${index}</a>
								</c:if> <c:if test="${!t}">
									<a
										href="/film/list?filmname=${param.filmname}&current=${index}">${index}</a>
								</c:if></li>
						</c:forEach>

						<li><c:if
								test="${pager.pagectrl.currentindex==pager.pagectrl.pagecount}"
								var="fp">
								<a style="disabled: true">下一页</a>
							</c:if> <c:if test="${!fp}">
								<a
									href="/film/list?filmname=${param.filmname}&current=${pager.pagectrl.currentindex+1}">下一页</a>
							</c:if></li>
					</ul>
				</div>
				<div style="color: red">${msg}</div>
			</div>
		</div>
	</div>
</body>
</html>